#ifndef AI_SEARCH_H
#define AI_SEARCH_H



#include "ai.h"



class ai_states_node
{

public:

	ai_states_node( ai_states_node* p, ai_game_state* s )
	{
		state = s;
		parent = p;
		if ( p != 0 )
		{
			p->children.push_back( this );
			depth = p->depth;
		}
		else
		{
			depth = 1;
		}
	};

	~ai_states_node();


	ai_states_node* parent;
	std::list< ai_states_node* > children;
	ai_game_state* state;
	unsigned int depth;
};


class search_algorithm: public algorithm
{

public:

	search_algorithm()
	{
		name = "Search algorithm";
	};

	virtual algorithm* clone()
	{
		search_algorithm* cl = clonetpl< search_algorithm >();
		return cl;
	};

	virtual void get_commands();


private:

	void search_state( ai_states_node* state_node );

	ai_states_node* search_tree;
	ai_states_node* best_state;

};



#endif